﻿#include "mainpopdialog.h"
#include "ui_mainpopdialog.h"

MainPopDialog::MainPopDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MainPopDialog)
{
    ui->setupUi(this);
    //ui->treeWidget->expandAll();

    m_pSelfMarketDlg = new SelfMarketDialog();
	m_bSubscribeContractsChoosedFlg= false;

    ui->tabWidget->insertTab(0,m_pSelfMarketDlg,QStringLiteral("自选行情"));
    ui->tabWidget->removeTab(1);
    ui->tabWidget->removeTab(1);

    ui->tabWidget->setCornerWidget(0);

    connect(((SelfMarketDialog*)m_pSelfMarketDlg),SIGNAL(destroyWin()),this,SLOT(MyAccept()));	
}

MainPopDialog::~MainPopDialog()
{
    delete ui;
}

void MainPopDialog::AddContractsInfo(CThostFtdcInstrumentField *pInstrument){
    ((SelfMarketDialog*)m_pSelfMarketDlg)->AddContractsInfo(pInstrument);
}
void MainPopDialog::SubscribeContractsChoosed(){
	if(m_bSubscribeContractsChoosedFlg == false){
		((SelfMarketDialog*)m_pSelfMarketDlg)->SubscribeContractsChoosed();
		m_bSubscribeContractsChoosedFlg = true;
	}    
}
void MainPopDialog::MyAccept(){
    this->accept();
}
